import 'package:boss/ui/page/commodity/pickerCategories/picker_commodity_provider.dart';
import 'package:boss/ui/widget/vertical_tab_view.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';

import '../categories_message.dart';
import 'categories_commodity_list.dart';
import 'package:hi_common/hi_common.dart';

class CategoriesCommodityBrowser extends StatelessWidget {
  final ItemScrollController commodityScrollController;

  const CategoriesCommodityBrowser({
    Key key,
    this.commodityScrollController,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Expanded(
      child: Consumer<PickerCommodityProvider>(builder: (context, provider, _) {
        return VerticalTabView(
          tabHeight: 90.w,
          builder: (context) {
            return Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                CategoriesMessage(),
                CategoriesCommodityList(scrollController: commodityScrollController),
              ],
            );
          },
          tabs: provider.storeMenus.map((menu) => menu.menuName).toList(),
          position: provider.storeMenuSelectIndex,
          onTabTap: (index) {
            provider.setStoreMenuSelectIndex(index);
          },
        );
      }),
    );
  }
}
